//
//  ExceptionalRecordCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/5/2.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "ExceptionalRecordCell.h"

@implementation ExceptionalRecordCell{
    UIImageView *headImageV;
    QXLable     *labName;
    QXLable     *labTime;
    UIButton    *btnExceptional;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        headImageV=[[UIImageView alloc]init];
        headImageV.layer.masksToBounds=YES;
        headImageV.layer.cornerRadius=20;
        [self.contentView addSubview:headImageV];
        [headImageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.equalTo(self.contentView).with.offset(10);
            make.bottom.equalTo(self.contentView).with.offset(-10);
            make.size.mas_equalTo(CGSizeMake(40, 40));
        }];
        
        labName=[[QXLable alloc]initTitle];
        [self.contentView addSubview:labName];
        [labName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(headImageV.mas_right).with.offset(10);
            make.top.equalTo(headImageV);
        }];
        
        labTime=[[QXLable alloc]initWithFount:13];
        [self.contentView addSubview:labTime];
        [labTime mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(headImageV.mas_right).with.offset(10);
            make.bottom.equalTo(headImageV);
        }];
        
        
        
        btnExceptional =[[UIButton alloc]init];
        [btnExceptional setTitle:@" 打赏" forState:UIControlStateNormal];
        btnExceptional.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
        [btnExceptional.titleLabel setFont:[UIFont systemFontOfSize:10]];
        [btnExceptional setTitleColor:NAVCOLOR forState:UIControlStateNormal];
        [btnExceptional setImage:[UIImage imageNamed:@"wing"] forState:UIControlStateNormal];
        [self.contentView addSubview:btnExceptional];
        [btnExceptional mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.right.equalTo(self.contentView).with.offset(-10);
            make.size.mas_equalTo(CGSizeMake(100, 25));
        }];
        
        UIView *line=[[UIView alloc]init];
        line.backgroundColor=DEFAULTBGCOLOR;
        [self.contentView addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.right.equalTo(self.contentView);
            make.height.mas_equalTo(@.7);
        }];
    }
    return self;
}

- (void)setModel:(ExceptionalRecordModel *)model{
    [headImageV sd_setImageWithURL:[NSURL URLWithString:model.Avatar]];
    labName.text=model.Name;
    labTime.text=model.SubTimeStr;
    [btnExceptional setTitle:model.Money forState:UIControlStateNormal];
}

@end
